Type GUI_v0_MainComponentFactory

	Global firstFactory:GUI_v0_MainComponentFactory

	Field nextFactory:GUI_v0_MainComponentFactory

	Function Fetch:GUI_v0_MainComponent_Abstract(name:String)
		Local factory:GUI_v0_MainComponentFactory=GUI_v0_MainComponentFactory.firstFactory
		While factory
			Local component:GUI_v0_MainComponent_Abstract = factory.CreateComponent(name)
			If component Then
				Return component
			End If
			factory = factory.nextFactory
		Wend		
	End Function
	
	Method New()
		nextFactory = GUI_v0_MainComponentFactory.firstFactory
		GUI_v0_MainComponentFactory.firstFactory = Self
	End Method

	Method CreateComponent:GUI_v0_MainComponent_Abstract(name:String)
		Local n:String = name.ToLower()
		Select n
			Case "test"
				Return New GUI_v0_MainComponent_Test
			Case "runtimepopup"
				Return New GUI_v0_MainComponent_RuntimePopup
			Default
				Return Null
		End Select			
	End Method

End Type

New GUI_v0_MainComponentFactory